import React, { Component } from 'react'
import styles  from './assemble.module.css'
import { ThemeContext } from './Parent'
export default class Grandson extends Component {
    constructor(){
        super()
        this.state = {
          Grandsondata:'孙子组件的数据'
        }
    }
    static getDerivedStateFromProps(props,state){
      return {
        Grandsondata:props.Grandparams
      }
    }
     //  getSnapshotBeforeUpdate
    componentDidMount(){
        console.log(this);
    }

    render() {
        return (
           <ThemeContext.Consumer>
               {
                  value=>(
                        <div className={styles.grandson}>
                        孙子组件 -  { this.props.Grandparams }
                      </div>
                  )
               }
            </ThemeContext.Consumer>
        )
    }
}
